<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/echars.js"></script>
    <script src="./js/jquery.min.js"></script>
    <style>
        * {
            margin: 0 auto;
        }

        .chart {
            width: 400px;
            height: 400px;
        }
    </style>
</head>
<body>
    <div class="chart pie"></div>
    <script>
        $(function() {
            echarts.init($('.pie')[0]).setOption({
                xAxis: {
                    data: ['01', '02', '03', '04', '05'],
                },
                yAxis: {},
                series: [{
                    name:'线性渐变',
                    type: 'bar',
                    data: [12,42,54,65,76],
                    itemStyle: {
                        color: {
                            type: 'linear',
                            x: 0,
                            x2: 1,
                            y: 0,
                            y2: 0,
                            colorStops: [
                                {
                                    offset: 0, color:'red',
                                },
                                {
                                    offset: 1, color:'blue'
                                }
                            ]
                        }
                    }
                }, {
                    name: '径向渐变',
                    type: 'bar', 
                    data: [65,23,76,32,76],
                    itemStyle: {
                        color: {
                            type: 'radial',
                            x: 1,
                            y: 1,
                            r: 1,
                            colorStops: [
                                {
                                    offset: 1, color: 'yellow',
                                },{
                                    offset: 1, color: 'green',
                                }
                            ]
                        }
                    }
                }]
            })
        })
    </script>
</body>
</html>